﻿using System;
using N3P.WCF.Proxyless.FullFramework45;
using ServiceContracts;

namespace Example45
{
    class Program
    {
        private static WcfClient<IMyInterface> _caller;

        static async void Run()
        {
            _caller = new WcfClient<IMyInterface>();

            try
            {
                var result = await _caller.CallAsync(x => x.MakeDate(1999, 12, 31));
                Console.WriteLine(result.ToShortDateString());
            }
            catch(Exception ex)
            {
                Console.WriteLine("Exception!");
                Console.WriteLine(ex);
            }
            finally
            {
                _caller.Dispose();
            }
        }

        static void Main()
        {
            Run();
            Console.ReadLine();
        }
    }
}
